
<%@ page  import="com.quality.bean.DdParams"%>
<%@ page  import="com.quality.service.DingTalkService"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>工艺下载</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">

ul li a {
	font-size: 2.3em;
}

ul li textarea{
     padding: 0px;
	 border: none;
	 outline: medium;
	 background-color:yellow;	 
	 -webkit-text-size-adjust:none;
	 width:79%;
	resize: vertical;
	 font-size:25px;

}
ul {
	list-style: none;
	background-color: white;
	color: black;
	border: 3px solid #999;
	min-height: 10em;
	border-radius: 25px;
	margin-top: 20px;
	margin-left: 17px;
	margin-right: -17px
}

.div_li_left {
	width: 60%;
	float: left;

}

.div_li_right {
	width: 35%;
	text-align: right;
	float: left;
	margin-right: 5%;

}
.li_space{
    line-height: 3.4em；
}

.name_long{
   margin-left: 5em;
}
table{
   background-color:white;
   display: block;
   height:auto;
   width:110%;
   margin-left: -5%;
   margin-top:-0.5em;
   border: none;
}
table tr{
   line-height:normal;
   vertical-align: middle;
   
}
table tr td {
  width:auto;
  vertical-align: middle;
  cellspacing:0; 
  cellpadding:0";
}
table tr td a{
   
   font-size:2.5em; 
  
   
   
}
.td1{
text-align: right;
width: 20%;
}
.td2{
text-align: left;
width: 60%;
}
.td3{
text-align: left;
}
input {
	background: none;
	outline-color: invert;
	outline-style: none;
	outline-width: 0px;
	text-shadow: none;
	-webkit-appearance: none;
	-webkit-user-select: text;
	outline-color: transparent;
	box-shadow: none;
	font-size:43px;
    float:left;
    border: 2px solid black;
    border-radius: 50px;
    width: 100%;
    height:auto;
    margin-top: 1%;
    padding-left: 15px;
}
</style>
<script type="text/javascript" src="./plugins/dingtalk.js">	</script>
<script type="text/javascript" src="./plugins/jquery-1.8.2.min.js"></script>

<script type="text/javascript" >
	
   var _globel_data;
 	
  //  var userName ='';
	var uId = '';
	
    window.onload = function loading() {
 	      getPlanList();
		
		  $('#sear').on('input propertychange', function() {
			//var count = $(this).val().length;
			//	$("#p_test").html("input Text 共" + count + "个：" + $(this).val());

			var searchText = $("#sear").val();
			if(searchText.length >= 2){
			  var str= searchText.substring(0,2);
			  var reg=/^[1-9]\d*$|^0$/; 
			 
			   // if(str=='SC'){
			   //     //按生产订单号查询
			   //      alert("生产订单号");
			   // }else if(escape(searchText).indexOf('%u') != -1){
			   //      alert("含有汉字--产品名称");
			   // }else if(reg.test(searchText)){
			   //      alert("纯数字--铸件号");
			   // }
			   
			}
			
		    

		});
		
  	}
 
    

 	
   
   //使用cookie获取用户名和id
	function getCookie() {
	
		var arr = (decodeURI(document.cookie)).split(';');
	
		for ( var i = 0; i < arr.length; i++) {
			var arr2 = arr[i].split('=');
			
			var item = arr2[0].replace('"','').replace('"','').replace(' ','');
			if(item == 'uId'){
			     
			      uId = arr2[1];
			     // uId='U0006';
			}
			
			
		//	if(item == 'uPass'){
			     
			//     uPass = arr2[1];
		//	}
		}
	}
 
   //获取列表内容(所属班组生产计划)
   function  getPlanList(){
       if(uId == '' ){
          getCookie();
       }
       getInfoByAjax('GxDownload',''); //参数：userId
   
   }
   
   //动态绘制界面
	function loadingPlanList(data){
	   var body = "";
		$("#div_planLists").empty();	
         
		for ( var i = 0; i < data.length; i++) {
             body += ("<ul onclick=\"jumpDownloadJsp('"+data[i]['FileID']+"')\">"
                     +"<li><div class=\"div_li_left\" ><a><b>"+data[i]['Productid']+"</b></a><a>("+data[i]['Pweight']+"吨)</a></div><div class=\"div_li_right\"><a>"+data[i]['Gy_Category']+"</a></div> </li>"
                     +"<li class=\"li_space\"><a>版本号："+data[i]['Edition']+"</a></li>"
                     +"<li class=\"li_space\"><a >产品名称：</a><a>"+data[i]['ProductName']+"</a></li>"
                     +"<li class=\"li_space\"><a >顾客名称：</a><a>"+data[i]['CustomerName']+"</a></li>"
                     +"<li class=\"li_space\" ><a >描述："+data[i]['ProductDh']+"</a></li>"
                     +"</ul>"
              );	 
		}
		$("#div_planLists").append(body);
		$("#div_planLists").show();
		body = "";
	
	}
	
	//公用ajax
	function getInfoByAjax(searchText,searchValue){
		$.ajax({
			type : "post",
			url : "servlet/SearchInfoServlet",
			data : {
				paramName : searchText,
				paramText : searchValue
			},
			dataType : "json",
			success : function(data, textStatus) {
			    //alert("工艺" + JSON.stringify(data));
			    if(data.length == 0){
			       alert("无工艺数据！");
			    }else{
					_globel_data = data;
			       loadingPlanList(data);
			    }
			     
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert("工艺数据查询失败，请重试！"); //+ textStatus + errorThrown
			}
		});

	
	}
	
	function searchClick() {
		var searchString = $('#sear').val();
		if(searchString != '' && searchString != null && searchString != undefined){
			var localdata = [];
			$.each(_globel_data,function (index, value) {
				if(value['ProductName'].indexOf(searchString) != -1){
					localdata.push(value);
					return;
				}
				if(value['Productid'].indexOf(searchString) != -1){
					localdata.push(value);
					return;
				}
				if(value['CustomerName'].indexOf(searchString) != -1){
					localdata.push(value);
					return;
				}
			})

			loadingPlanList(localdata);
		}else{
			loadingPlanList(_globel_data);
		}
	}
	
	 function jumpDownloadJsp(fileID){
	    //@参数1：生产订单号  @参数2：工序名称
	    window.location.href = "servlet/DownloadServlet?fileID=" + fileID;
	
	}
	

</script>


  </head>
  
 <body style="background-color: #009688;">
 
    <table >
    	<tr >
    		<td  class="td1"><a >搜索：</a></td>
    		<td  class="td2"><input id="sear"  type="text" /></td>
      		<td class="td3"> <img alt="" src="./img/sear.png"  onclick="searchClick()"></td>
     
  		</tr>
    
    </table>

	<div id = "div_planLists"  >
	   
	</div>
	
</body>
</html>
